﻿using System.Data.Entity.ModelConfiguration;
using eCommerce.Core.Domain.Products;

namespace eCommerce.Data.Mapping.Products
{
    public class ProductVariantMapping : EntityTypeConfiguration<ProductVariant>
    {
        public ProductVariantMapping()
        {
            this.ToTable("ProductVariants");
            this.HasKey(p => p.Id);
            //this.Property(p => p.ProductName).IsRequired().HasMaxLength(400);
      
            //this.HasRequired(s => s.Shop).WithMany(c => c.Products)
            //    .HasForeignKey(o => o.ShopId).WillCascadeOnDelete(false);

            this.HasOptional(c=>c.ItemAttributeKey).WithRequired(c=>c.ProductVariant).WillCascadeOnDelete(false);
        }
    }
}